package com.txunda.zhuohired.http;

import com.ants.theantsgo.base.BaseView;
import com.ants.theantsgo.config.Config;
import com.ants.theantsgo.httpTools.ApiTool2;
import com.lidroid.xutils.http.RequestParams;

import java.io.File;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/4/8 9:53
 * 功能描述：简历模块
 * 联系方式：jiahuanchen@126.com
 */

public class Resume {
    private static String url = Config.BASE_URL + "Resume/";

    /**
     * 简历首页
     *
     * @param token    用户token
     * @param baseView
     */
    public void resume(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "resume", params, baseView);
    }

    /**
     * 头像上传
     *
     * @param token    用户token
     * @param pic      头像
     * @param baseView
     */
    public void headPicIn(String token, File pic, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        if (pic != null && pic.exists())
            params.addBodyParameter("pic", pic);
        apiTool.postApi(url + "headPicIn", params, baseView);
    }

    /**
     * 实习/工作经历列表
     *
     * @param token    用户token
     * @param baseView
     */
    public void practice(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "practice", params, baseView);
    }

    /**
     * 添加工作经验
     *
     * @param company_name  公司名称
     * @param start_time    开始时间
     * @param end_time      结束时间 0为至今
     * @param position_name 岗位名称
     * @param practice_desc 工作内容
     * @param token         用户token
     * @param baseView
     */
    public void addPractice(String company_name, String start_time, String end_time, String position_name, String
            practice_desc, String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("company_name", company_name);
        params.addBodyParameter("start_time", start_time);
        params.addBodyParameter("end_time", end_time);
        params.addBodyParameter("position_name", position_name);
        params.addBodyParameter("practice_desc", practice_desc);
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "addPractice", params, baseView);
    }

    /**
     * 教育经历
     *
     * @param token    用户token
     * @param baseView
     */
    public void educationList(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "educationList", params, baseView);
    }

    /**
     * 删除方法(公共)
     *
     * @param ids      删除ID 用‘，’间隔
     * @param model    删除项目（UserPractice.工作经历，UserEducation.教育经历，UserJob.项目经历，Social.社交主页）
     * @param baseView
     */
    public void delPractice(String ids, String model, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("ids", ids);
        params.addBodyParameter("model", model);
        apiTool.postApi(url + "delPractice", params, baseView);
    }

    /**
     * 添加教育经历
     *
     * @param token           用户token
     * @param school_name     学校名称
     * @param profession_name 专业名称
     * @param education_id    学历
     * @param start_time      入学时间
     * @param end_time        结束时间
     * @param baseView
     */
    public void addEducation(String token, String school_name, String profession_name, String education_id, String
            start_time, String end_time, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("school_name", school_name);
        params.addBodyParameter("profession_name", profession_name);
        params.addBodyParameter("education_id", education_id);
        params.addBodyParameter("start_time", start_time);
        params.addBodyParameter("end_time", end_time);
        apiTool.postApi(url + "addEducation", params, baseView);
    }

    /**
     * 添加项目经历
     *
     * @param token      用户token
     * @param job_name   项目名称
     * @param job_desc   项目介绍
     * @param start_time 入学时间
     * @param end_time   结束时间
     * @param baseView
     */
    public void addJob(String token, String job_name, String job_desc, String
            start_time, String end_time, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("job_name", job_name);
        params.addBodyParameter("job_desc", job_desc);
        params.addBodyParameter("start_time", start_time);
        params.addBodyParameter("end_time", end_time);
        apiTool.postApi(url + "addJob", params, baseView);
    }

    /**
     * 项目经历列表
     *
     * @param token    用户token
     * @param baseView
     */
    public void job(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "job", params, baseView);
    }

    /**
     * 社交主页列表
     *
     * @param token    用户token
     * @param baseView
     */
    public void social(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "social", params, baseView);
    }

    /**
     * 添加社交主页
     *
     * @param token    用户token
     * @param social   社交主页
     * @param baseView
     */
    public void addSocial(String token, String social, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("social", social);
        apiTool.postApi(url + "addSocial", params, baseView);
    }

    /**
     * 获得自我评价
     *
     * @param token    用户token
     * @param ids      显示过的自我评价的ID集合 用‘，’间隔 看看别人怎么写时有此参数
     * @param baseView
     */
    public void getSelf(String token, String ids, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("ids", ids);
        apiTool.postApi(url + "getSelf", params, baseView);
    }

    /**
     * 自我评价提交
     *
     * @param token      用户token
     * @param self_speak 自我评价
     * @param baseView
     */
    public void self(String token, String self_speak, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("self_speak", self_speak);
        apiTool.postApi(url + "self", params, baseView);
    }

    /**
     * 用户信息
     *
     * @param token    用户token
     * @param baseView
     */
    public void userInfo(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "userInfo", params, baseView);
    }

    /**
     * 求职意向
     *
     * @param token    用户token
     * @param baseView
     */
    public void jobIntension(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "jobIntension", params, baseView);
    }

    /**
     * 获取学历
     *
     * @param baseView
     */
    public void education(BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "education", params, baseView);
    }

    /**
     * 简历预览
     *
     * @param token    用户token
     * @param baseView
     */
    public void resumeShow(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "resumeShow", params, baseView);
    }

    /**
     * 随机自我评价
     *
     * @param baseView
     */
    public void getOtherSelf( BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "getOtherSelf", params, baseView);
    }

}
